package com.logistics.config;

import com.logistics.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //registry是一个注册器
        //浏览器每次请求都会执行拦截器
        //拦截器不拦这两个，拦其他
        registry.addInterceptor(loginInterceptor).excludePathPatterns("/admin/login","/admin/register");
    }
}
